import axios from 'axios'
import {BaseUrl} from './mf'
import loding from '../components/loding/loding'

let AXIOS =axios.create({
    baseURL:BaseUrl,
    timeout:1000000000
})

let Lodings;
Lodings=loding()
let lo=0

// 添加请求拦截器
AXIOS.interceptors.request.use(function (config) {
  lo++
    Lodings.show=true
    return config;
  }, function (error) {
    Lodings.show=false
    return Promise.reject(error);
  });
AXIOS.interceptors.response.use(function (response) {
  lo--
  if(lo==0){
    Lodings.show=false
  }
    
    return response;
  }, function (error) {

     lo--
  if(lo==0){
    Lodings.show=false
  }
    return Promise.reject(error);
  });


export default async function request(congin){
    return AXIOS.request(congin).then(res=>{
        return res
    }).catch(res=>{
        
    })
}